<?php echo $head ?>
<?php echo $b_head?>
<form action="" method="post" class="form form-horizontal">
    <div class="settings" style="display: block;">
        <div class="panel panel-info">
            <div class="panel-heading"> 首页公告设置</div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">公告提示语</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="nTip" class="form-control" value="#nickname#连闯三关，赢得#gname#">
                        <div class="help-block">#nickname#为会员昵称占位符，#gname#为奖品名称占位符</div>
                        <div class="help-block">例如：#nickname#连闯三关，赢得#gname#</div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-12">
                        <table class="table">
                            <thead>
                            <tr>
                                <th style="width:60px;"></th>
                                <th style="width:400px;">内容</th>
                                <th style="width:200px;">链接</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="notice_tbody">
                            <tr class="notice-item">
                                <td><a href="javascript:;" class="btn btn-default btn-sm btn-move"><i
                                            class="fa fa-arrows"></i></a></td>
                                <td><input type="text" class="form-control" name="notice_txt[]"
                                           value="小耐里连闯三关，赢得MAC口红"></td>
                                <td><input type="text" class="form-control" name="notice_url[]" value=""></td>
                                <td>
                                    <button type="button" class="btn btn-danger  btn-sm"
                                            onclick="removeNotice(this)"><i class="fa fa-remove"></i></button>
                                </td>
                            </tr>
                            <tr class="notice-item">
                                <td><a href="javascript:;" class="btn btn-default btn-sm btn-move"><i
                                            class="fa fa-arrows"></i></a></td>
                                <td><input type="text" class="form-control" name="notice_txt[]"
                                           value="秦宝.连闯三关，赢得兰蔻口红"></td>
                                <td><input type="text" class="form-control" name="notice_url[]" value=""></td>
                                <td>
                                    <button type="button" class="btn btn-danger  btn-sm"
                                            onclick="removeNotice(this)"><i class="fa fa-remove"></i></button>
                                </td>
                            </tr>
                            <tr class="notice-item">
                                <td><a href="javascript:;" class="btn btn-default btn-sm btn-move"><i
                                            class="fa fa-arrows"></i></a></td>
                                <td><input type="text" class="form-control" name="notice_txt[]"
                                           value="Supreme连闯三关，赢得圣罗兰口红"></td>
                                <td><input type="text" class="form-control" name="notice_url[]" value=""></td>
                                <td>
                                    <button type="button" class="btn btn-danger  btn-sm"
                                            onclick="removeNotice(this)"><i class="fa fa-remove"></i></button>
                                </td>
                            </tr>
                            <tr class="notice-item">
                                <td><a href="javascript:;" class="btn btn-default btn-sm btn-move"><i
                                            class="fa fa-arrows"></i></a></td>
                                <td><input type="text" class="form-control" name="notice_txt[]"
                                           value="烟花连闯三关，赢得迪奥口红"></td>
                                <td><input type="text" class="form-control" name="notice_url[]" value=""></td>
                                <td>
                                    <button type="button" class="btn btn-danger  btn-sm"
                                            onclick="removeNotice(this)"><i class="fa fa-remove"></i></button>
                                </td>
                            </tr>
                            <tr class="notice-item">
                                <td><a href="javascript:;" class="btn btn-default btn-sm btn-move"><i
                                            class="fa fa-arrows"></i></a></td>
                                <td><input type="text" class="form-control" name="notice_txt[]"
                                           value="凤妹儿连闯三关，赢得迪奥口红"></td>
                                <td><input type="text" class="form-control" name="notice_url[]" value=""></td>
                                <td>
                                    <button type="button" class="btn btn-danger  btn-sm"
                                            onclick="removeNotice(this)"><i class="fa fa-remove"></i></button>
                                </td>
                            </tr>
                            <tr class="notice-item">
                                <td><a href="javascript:;" class="btn btn-default btn-sm btn-move"><i
                                            class="fa fa-arrows"></i></a></td>
                                <td><input type="text" class="form-control" name="notice_txt[]"
                                           value="范二姑凉连闯三关，赢得MAC口红"></td>
                                <td><input type="text" class="form-control" name="notice_url[]" value=""></td>
                                <td>
                                    <button type="button" class="btn btn-danger  btn-sm"
                                            onclick="removeNotice(this)"><i class="fa fa-remove"></i></button>
                                </td>
                            </tr>
                            <tr class="notice-item">
                                <td><a href="javascript:;" class="btn btn-default btn-sm btn-move"><i
                                            class="fa fa-arrows"></i></a></td>
                                <td><input type="text" class="form-control" name="notice_txt[]"
                                           value="你的宝贝连闯三关，赢得迪奥口红"></td>
                                <td><input type="text" class="form-control" name="notice_url[]" value=""></td>
                                <td>
                                    <button type="button" class="btn btn-danger  btn-sm"
                                            onclick="removeNotice(this)"><i class="fa fa-remove"></i></button>
                                </td>
                            </tr>
                            <tr class="notice-item">
                                <td><a href="javascript:;" class="btn btn-default btn-sm btn-move"><i
                                            class="fa fa-arrows"></i></a></td>
                                <td><input type="text" class="form-control" name="notice_txt[]"
                                           value="张艳:)连闯三关，赢得圣罗兰口红"></td>
                                <td><input type="text" class="form-control" name="notice_url[]" value=""></td>
                                <td>
                                    <button type="button" class="btn btn-danger  btn-sm"
                                            onclick="removeNotice(this)"><i class="fa fa-remove"></i></button>
                                </td>
                            </tr>
                            </tbody>
                            <tbody>
                            <tr>
                                <td colspan="4">
                                    <button type="button" class="btn btn-default  btn-sm" onclick="addNotice()"><i
                                            class="fa fa-plus"></i> 添加公告
                                    </button>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <script text="text/javascript">
            $(function () {
                bindEvents();
            });
            function bindEvents() {
                require(['jquery.ui'], function () {
                    $("#notice_tbody").sortable({handle: '.btn-move'});
                });
            }
            //添加公告
            function addNotice() {
                var html = '<tr class="notice-item">';
                html += '<td><a href="javascript:;" class="btn btn-default btn-sm btn-move"><i class="fa fa-arrows"></i></a></td>';
                html += '<td><input type="text" class="form-control" name="notice_txt[]" /></td>';
                html += '<td><input type="text" class="form-control" name="notice_url[]" /></td>';
                html += '<td><button type="button" class="btn btn-danger  btn-sm" onclick="removeNotice(this)"><i class="fa fa-remove"></i></button>';

                html += '</td>';
                html += '</tr>';
                $('#notice_tbody').append(html);
                bindEvents();
            }
            function removeNotice(obj) {
                $(obj).closest('.notice-item').remove();
            }
        </script>
    </div>
    <button class="btn btn-primary" type="submit" name="submit" value="提交">提交</button>
</form>
</div>